﻿<%@ WebHandler Language="C#" Class="FileCS" %>

using System;
using System.Web;

public class FileCS : IHttpHandler
{
   // Manager mgr = new Manager(true, "ConnectionString");

    public void ProcessRequest (HttpContext context) 
    {
           
            int Id = Convert.ToInt32(context.Request.QueryString["Id"].ToString());


            System.Data.SqlClient.SqlDataReader reader = CustomRepository.CustumExecutQuery("select * from tbl_DoctorProfile  where id= " + Id + "");
            string name;
        if (reader.HasRows)
        {
            while (reader.Read())
            {
                name = reader["Video_Name"].ToString();
                context.Response.ContentType = reader["Video_Name"].ToString();
                context.Response.BinaryWrite((byte[])reader["Video"]);
                context.Response.Clear();
                context.Response.Buffer = true;
                context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name);
                context.Response.End();

            }
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}